package com.lee.mao.bean;

import android.os.Parcel;
import android.os.Parcelable;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Unique;
import org.greenrobot.greendao.annotation.Generated;

@Entity
public class ClassifyTable implements Parcelable {

    @Unique
    @Id(autoincrement = true)
    private Long id;//id自增长

    //名称
    private String name;

    //类型
    private int type;

    public ClassifyTable(String name, int type) {
        this.name = name;
        this.type = type;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    @Override
    public String toString() {
        return "ClassifyTable{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", type=" + type +
                '}';
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeValue(this.id);
        dest.writeString(this.name);
        dest.writeInt(this.type);
    }

    public void readFromParcel(Parcel source) {
        this.id = (Long) source.readValue(Long.class.getClassLoader());
        this.name = source.readString();
        this.type = source.readInt();
    }

    protected ClassifyTable(Parcel in) {
        this.id = (Long) in.readValue(Long.class.getClassLoader());
        this.name = in.readString();
        this.type = in.readInt();
    }

    @Generated(hash = 1626751331)
    public ClassifyTable(Long id, String name, int type) {
        this.id = id;
        this.name = name;
        this.type = type;
    }

    @Generated(hash = 270909972)
    public ClassifyTable() {
    }

    public static final Creator<ClassifyTable> CREATOR = new Creator<ClassifyTable>() {
        @Override
        public ClassifyTable createFromParcel(Parcel source) {
            return new ClassifyTable(source);
        }

        @Override
        public ClassifyTable[] newArray(int size) {
            return new ClassifyTable[size];
        }
    };
}